import 'package:boss/models/takeout_order_list_data.dart';
import 'package:boss/provider/takeout_process_provider.dart';
import 'package:boss/ui/page/takeoutManagement/page/takeoutProcess/modal/refund_modal.dart';
import 'package:boss/ui/widget/button/outline_radius_button.dart';
import 'package:boss/ui/widget/button/radius_button.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class SelfPickupButtonGroup extends StatelessWidget {
  final TakeoutOrderItem data;

  const SelfPickupButtonGroup({Key key, this.data}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.spaceAround,
      children: <Widget>[
        OutlineRadiusButton(
          title: '退款',
          onTap: () async {
            showRefundModal(context, data: data);
          },
        ),
        RadiusButton(
          title: '客户已取餐',
          onTap: () async {
            var provider = Provider.of<TakeoutProcessProvider>(
              context,
              listen: false,
            );
            provider.picked(
              data.takeOutId,
              data.pickupCode,
            );
          },
        ),
      ],
    );
  }
}
